//app.js
App({
  onLaunch: function () {
    var that = this;
    wx.login({
      success: function (res) {
        if (res.code) {
          // console.log(res.code)
          wx.request({
            // url: that.globalData.url + 'accs/login',
            url: that.globalData.url + 'lotteryaccs/login',
            method: 'POST',
            data: {
              gh_id: 'gh_1c1ff0eef26f',
              code: res.code,
            },
            success: function (res) {
              // console.log(res);
              that.globalData.acc = res.data.data
              that.globalData.openId = res.data.data.openid
              that.globalData.userId = res.data.data.userid
            },
          })
        } else {
          console.log('获取用户登录态失败！' + res.errMsg);
        }
      }
    })
  },
  globalData: {
    version: '1.0.0',
    acc: null,
    userInfo: null,
    userId: 0,
    openid: null,
    url: 'https://xcx.nanxuncn.cn/api/lottery/',
    // imageUrl: 'https://xcx.nanxuncn.cn',
    // globalFormIds: null
  }
})